package com.example.lms.controller;

import com.example.lms.entity.Customers;
import com.example.lms.service.CustomersService;
import com.example.lms.vo.CustomersGoodsCountInfo;
import com.example.lms.vo.D;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * @module 客户
 * @author：DUOLUONIANDAI
 * @DATA：2024/05/11
 * @Title：
 */

@RestController
public class CustomersController {

    @Resource
    CustomersService customersService;

    /**
     * @param
     * @return
     * @Title Api fox-api
     * @api.name 请求用户的全部信息
     * @folder 客户
     */

    @GetMapping("getCountCustomersAllGoods")
    public ArrayList<CustomersGoodsCountInfo> getCountCustomersAllGoods() {
        return customersService.getAllCustomers();
    }

    /**
     * @param
     * @return
     * @Title Api fox-api
     * @api.name 更新用户信息
     * @folder 客户
     */


    @PutMapping("updateCustomersInfo")
    public D updateCustomersInfo(Customers customers) {
        return customersService.changeUserInfo(customers);
    }

    /**
     * @param
     * @return D
     * @Title Api fox-api
     * @api.name 删除用户的所有包裹信息
     * @folder 客户
     */

    @DeleteMapping("delCustomersAllInfo")
    public D delCustomersAllInfo(@RequestParam("id") String id) {
        return customersService.delUser(id);
    }
    /**
     * @param
     * @return D
     * @Title Api fox-api
     * @api.name 添加用户
     * @folder 客户
     */

    @PostMapping("addCustomers")
    public D addCustomers(@RequestBody Customers customers){
        return customersService.addUser(customers);
    }

}
